package ltg.ibutton.core;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;

public abstract class Simulation extends Observable implements Observer {
	protected Machine machine = null;
	
	public Simulation() {
		machine = Machine.getMachineInstance();
		ArrayList<String> probes = this.getTriggeredProbes();
		for(Iterator<String> i = probes.iterator(); i.hasNext();) {
			try {
				machine.stopReaderAutoUpdate((String) i.next());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		machine.addObserver(this);
		System.out.println("In Simulation");
		System.out.println(machine);
	}
	
	public void update(Observable arg0, Object arg1) {
		setChanged();
		notifyObservers(arg1);
	}
	
	protected abstract ArrayList<String> getTriggeredProbes();
	public abstract ArrayList<Concept> getSimulationState();

}
